package cc.vv.btpartyjob.partyservice.delegate

import android.view.View
import android.widget.RelativeLayout
import android.widget.TextView
import cc.vv.baselibrary.util.ColorUtil
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partyservice.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 微心愿详情托管类
 * Created by Chen.qi on 2018/10/27.
 */
class TinyWishDetailActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_tiny_wish_detail
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_atwD_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_atwD_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 设置许愿人姓名
     */
    fun setTinyName(name: String?) {
        getView<TextView>(R.id.et_atwD_inputName)?.text = name
    }

    /**
     * 设置联系方式
     */
    fun setTinyTel(mobile: String?) {
        getView<TextView>(R.id.et_atwD_inputTelPhone)?.text = mobile
    }

    /**
     * 设置地址
     */
    fun setTinyAddress(address: String?) {
        getView<TextView>(R.id.et_atwD_inputAddress)?.text = address
    }

    /**
     * 设置心愿内容
     */
    fun setTinyContent(content: String?) {
        getView<TextView>(R.id.et_atwD_inputContent)?.text = content
    }

    /**
     * 设置起止时间
     */
    fun setTinyTime(time: String?) {
        getView<TextView>(R.id.et_atwD_time)?.text = time
    }

    /**
     * 设置认领状态
     */
    fun setTinyStatus(status: String?, type: Int) {
        val viewStatus = getView<TextView>(R.id.et_atwD_rlStatus)
        if (1 == type) {
            //已认领
            viewStatus?.setTextColor(ColorUtil.setBCColor(R.color.color_D8D8D8))
        }
        viewStatus?.text = status
    }

    /**
     * 设置认领按钮是否显示
     */
    fun setSubmitButtonShow(isShow: Boolean) {
        val viewSubmit = getView<RelativeLayout>(R.id.rl_atwD_tinyWishRL)
        if (isShow) {
            viewSubmit?.visibility = View.VISIBLE
        } else {
            viewSubmit?.visibility = View.GONE
        }
    }
}